package data.base;

import java.awt.Color;

/**
 * This class represents a point light with
 * color and intensity.
 * @author Simon
 *
 */
public class PointLight extends Vector3{
  private double intensity;
  private RenderColor color;
  
  /**
   * Constructs a point light with intensity 1.0
   * and color white.
   * @param point the position of the light
   */
  public PointLight(Vector3 point){
    this(point, 1d, Color.WHITE);
  }

  /**
   * Constructs a point light
   * @param point the position of the light
   * @param intensity the intensity of the light
   * @param color the color of the light
   */
  public PointLight(Vector3 point, double intensity, Color c) {
    super(point.getX(), point.getY(), point.getZ());
    this.intensity = intensity;
    color = new RenderColor(c);
  }

  /**
   * @return the intensity of the light.
   */
  public double getIntensity() {
    return intensity;
  }

  /**
   * @return the color of the light.
   */
  public Color getColor() {
    return color.getColor();
  }
  
  public RenderColor getRenderColor(){
    RenderColor c = color.clone();
    c.multiplyBrightness(intensity);
    return c;
  }

  /**
   * Sets the intensity of the light
   * @param intensity
   */
  public void setIntensity(double intensity) {
    this.intensity = intensity;
  }

  /**
   * Sets the intensity of the color
   * @param intensity
   */
  public void setColor(Color c) {
    color = new RenderColor(c);
  }
}
